package makex

import (
	"fmt"

	"std/abcx"

	"github.com/gookit/color"
)

type P struct {
}

func (p P) name() {
	var ok *string //nil
	fmt.Println(ok)
	*ok = "asd"
}
func (p P) name2() {
	var ok *string //nil
	ok2 := "ads"
	color.Redln(ok, ":", "-", ok2, ":", &ok2)
	ok = &ok2
	color.Redln(ok, ":", *ok, "-", ok2, ":", &ok2)
	*ok = "aaaa"
	color.Redln(ok, ":", *ok, "-", ok2, ":", &ok2)

}
func (p P) new() {
	//defer func() {
	//	if ok := recover(); ok != nil {
	//		fmt.Println("panic!")
	//	}
	//}()
	h := new(abcx.Person) //分配空間

	s := new(string)

	color.Redln(h, ":", *h, "-", s, ":", *s)
	color.Redf("%T:%v-%T:%v\n", h, *h, s, *s)
	//func() {
	h.Age = 10
	//	*h.Addr = "asd" //err
	//}()
	func() {
		//m := new(map[string]string) // nil
		//(*m)["asd"] = "asd"
		//color.Redln(m, ":", *m)
	}()
	color.Redln(h, ":", *h, "-", s, ":", *s)
	color.Redf("%T:%v-%T:%v\n", h, *h, s, *s)

}
func (p P) make() {
	h := new(abcx.Person) //分配空間
	s := new(string)
	color.Redln(h, ":", *h, "-", s, ":", *s)
	color.Redf("%T:%v-%T:%v", h, *h, s, *s)

}
